<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="${request.contextPath}/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="${request.contextPath}/plug/layui/css/layui.css" rel="stylesheet">
    <link href="${request.contextPath}/css/layui-admin.css" rel="stylesheet">
    <link href="${request.contextPath}/css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="${request.contextPath}/css/animate.min.css" rel="stylesheet">
    <link href="${request.contextPath}/css/style.min.css?v=3.0.0" rel="stylesheet">
    <script src="${request.contextPath}/js/jquery.min.js"></script>
    <script src="${request.contextPath}/js/bootstrap.min.js"></script>
    <script src="${request.contextPath}/plug/layui/layui.all.js"></script>
    <link href="${request.contextPath}/css/plugins/iCheck/custom.css" rel="stylesheet">
    <script src="${request.contextPath}/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${request.contextPath}/js/plugins/iCheck/icheck.min.js"></script>
    <script src="${request.contextPath}/js/ajaxfileupload.js"></script>
    <title></title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-title">
                    <div class="text-left">个人资料</div>
                    <div class="ibox-tools">

                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" id="signupForm" action="">
                        <input type="hidden" value="${user.id!}" name="id" id="id"/>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">账号</label>
                            <div class="col-sm-10">
                                <div class="row">
                                    <div class="col-md-6">
                                        <input type="text" class="form-control" name="account" value="<#if user.accountName??>${user.accountName!}<#else>${user.id!}</#if>" validate="" disabled/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">姓名</label>
                            <div class="col-sm-10">
                                <div class="row">
                                    <div class="col-md-6">
                                        <input type="text" class="form-control" name="real_name" value="${user.userName!}" validate="required:true" id="userName"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">原始密码</label>
                            <div class="col-sm-10">
                                <div class="row">
                                    <div class="col-md-6">
                                        <input type="password" class="form-control" name="pwd"  id="pwd" value="${user.password!}"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">新密码</label>
                            <div class="col-sm-10">
                                <div class="row">
                                    <div class="col-md-6">
                                        <input type="password" class="form-control" name="new_pwd" id="new_pwd"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">确认新密码</label>
                            <div class="col-sm-10">
                                <div class="row">
                                    <div class="col-md-6">
                                        <input type="password" class="form-control" name="new_pwd_ok" id="new_pwd_ok"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group" style="text-align: center;">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary add" type="button">提交</button>
                            </div>
                        </div>
                    </form>
                </div>

            </div>

        </div>
    </div>




    <script>
    $eb = parent._mpApi;
    $().ready(function() {
        $("#signupForm").validate();
    })
    $('.add').on('click',function (e) {
         var obj = new Object();
         obj.id = $('#id').val();
         obj.userName = $('#userName').val();
         obj.password = $('#pwd').val();
         obj.newPwd = $('#new_pwd').val();
         obj.newPwdOk = $('#new_pwd_ok').val();
         if(obj.userName.length < 1) return $eb.message('error','请填写姓名');
            var url = "${request.contextPath}/admin/updateUserInfo";
            $.ajax({
                type: 'POST',
                url:url,
                data: JSON.stringify(obj),
                dataType:'json',
                contentType:'application/json',
                success:function (re) {
                    if(re.code == 200)
                        return $eb.message('success',"修改成功");
                    else
                        return $eb.message('error',re.msg);
                }
            })
    })
</script>


</div>
</body>
</html>